<?php

namespace Admin\Controller;
//use Think\Controller;
use Think\Think;
use Tools\AdminController;


class  AuthController extends AdminController {
    function showlist() {
        $info=D('Auth')->order('auth_path')->select();



        $this->assign('info',$info);
        $this->display();
    }

    function tianjia() {
        //展示权限
        $auth=new \Model\AuthModel();
        if(!empty($_POST)){
            //收集权限
            $z=$auth->saveData($_POST);
            if ($z){
                $this->redirect('showlist',array(),1,'添加成功');
            }else{
                $this->redirect('tianjia',array(),1,'添加失败');
            }


            //dump($_POST);
        }else{
            $auth_infoA=$auth->where('auth_level=0')->select();


            $this->assign('auth_infoA',$auth_infoA);
            $this->display();
        }






        
    }




}